<template>
  <div o-Container>
    <o-list v-bind:source="list.push"
            v-bind="{created:create,modified:modify,exported:output}"/>
    <o-dialog v-bind:source="panel" v-bind="{opened:load,closed:load}">
      <template slot="content">
        <o-item v-bind:source="item.push" v-bind="{saved:save,backed:back}"></o-item>
      </template>
    </o-dialog>
  </div>
</template>

<script>
  export default {
    name: "mms_policy_push_list", /* 这个name暂时不知道用啥用，根据官方文档说的是方便排错的 */
    data() {
      return {
        octopus: this.$parent.octopus,
        list: {
          push: {
            data: {
              id: 313,
              cellData: [
                {name: "ID", width: 30},
                {name: "TypeID", width: 80, searchKey: "="},
                {name: "TitleData", width: 170, searchKey: "LIKE"},
                {name: "ContentData", width: 800, searchKey: "LIKE"},
                {name: "CreateTime", width: 170},
              ],
            },
            exportName: '推送策略'
          },
        },
        item: {
          push: {
            // 以下参数默认由组件内部创建，但是如果有需要，开发人员可在这里提前设置，组件将按照您的预期渲染。
            // cache: false,
            // control: null,
            // dataExtend: null,
            data: {
              id: 313,
              // value: "",
              cellData: [
                {name: "TypeID"},
                {name: "CreateTime"},
                {name: "TitleData"},
                {name: "ContentData"},
              ]
            },
          },
        },
        panel: {
          visible: false,
        },
      }
    },
    methods: {
      modify: function (row) {
        this.item.push.data.value = row.ID;
        this.item.push.control.load();

        this.panel.visible = true;
      },
      view: function (row) {
        alert("view key: " + JSON.stringify(row));
      },
      save: function (data) {
        this.octopus.tips.success(data); //提示
        // 刷新list
        this.list.push.control.load();
        this.back(); //返回
      },
      back: function () {
        this.panel.visible = false; // 取消
      },
      create: function () {
        this.item.push.data.value = null;
        this.item.push.control.load(); //刷新

        this.panel.visible = true; //打开
      },
      output: function (data) {
        //导出
      },
    },
    props: ["oData"] // 复制
  }
</script>
